package com.wl.scanner;

import org.junit.Test;

import java.util.Scanner;

/**
 * @author wanglei
 */
public class Demo1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Scanner scanner1 = new Scanner(System.in);

        System.out.println("next请输入:");
        if(scanner.hasNext()){
            String str = scanner.next();
            System.out.println("next接受:"+str);
        }

        System.out.println("nextLine请输入:");
        if(scanner1.hasNext()){
            String str = scanner1.nextLine();
            System.out.println("nextLine接受:"+str);
        }
        //凡是属于IO流的如果不关闭就会占用资源
        scanner.close();
        scanner1.close();
    }
}
